package cn.calm.database.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.log4j.Logger;

import cn.calm.commons.service.defaultimpl.DefaultServiceImpl;
import cn.calm.database.dao.IDatabaseDao;
import cn.calm.database.entity.TableInfo;
import cn.calm.database.service.IDatabaseService;

public class DatabaseServiceImpl<T extends TableInfo> extends
		DefaultServiceImpl<T> implements IDatabaseService<T> {
	private IDatabaseDao databaseDao;
	private static final Logger logger = Logger
			.getLogger(DatabaseServiceImpl.class);

	@Override
	public List<List<String>> executSql(String sql) throws SQLException {
		logger.debug("executSql start");
		try{
			logger.info("sqlText:"+sql);
			return databaseDao.executSql(sql);
		}finally{
			logger.debug("executSql end");
		}
		
	}

	public IDatabaseDao getDatabaseDao() {
		return databaseDao;
	}

	public void setDatabaseDao(IDatabaseDao databaseDao) {
		this.databaseDao = databaseDao;
	}

}
